package com.producer.queue.define;

import com.producer.queue.bean.DataBean;
import org.springframework.beans.factory.annotation.Value;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Author : liu lin qin
 * @Date :  Created by pangoin on 2019/8/26.
 */
public class TaskDefine {

    @Value("${task.dealing.size}")
    private static int FILE_QUEUE_SIZE=1000;
    @Value("${output.dealing.size}")
    private int outPutDealing=2000;
    // 创建数组型缓冲等待队列
    public static BlockingQueue<Runnable> bq = new ArrayBlockingQueue<Runnable>(2000);

    public static BlockingQueue<DataBean> mainQueue = new ArrayBlockingQueue<DataBean>(
            FILE_QUEUE_SIZE);
    public static BlockingQueue<DataBean> childQueue = new ArrayBlockingQueue<DataBean>(
            FILE_QUEUE_SIZE);

    public  static ThreadPoolExecutor threadPool = new ThreadPoolExecutor(200, 1000, 50, TimeUnit.MILLISECONDS, bq);
}
